From: Carlos Garnacho Date: Wed, 5 Jul 2017 22:03:12 +0000 (+0200) Subject: padOsd: Refactor function setting label after edition into separate function X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~252 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=7991a5318957faca06ea94bb2b74218935ddc2d9;p=gnome-shell.git padOsd: Refactor function setting label after edition into separate function https://bugzilla.gnome.org/show_bug.cgi?id=782033 --- diff --git a/js/ui/padOsd.js b/js/ui/padOsd.js index 27dfb6637..bdc381f9d 100644 --- a/js/ui/padOsd.js +++ b/js/ui/padOsd.js @@ -550,18 +550,22 @@ const PadDiagram = new Lang.Class({ this.add_actor(label); }, + _applyLabel: function(label, action, idx, dir, str) { + if (str != null) { + label.set_text(str); + + let [found, x, y, arrangement] = this.getLabelCoords(action, idx, dir); + this._allocateChild(label, x, y, arrangement); + } + label.show(); + }, + stopEdition: function (str) { this._editorActor.hide(); if (this._curEdited) { let [label, action, idx, dir] = this._curEdited; - if (str != null) { - label.set_text(str); - - let [found, x, y, arrangement] = this.getLabelCoords(action, idx, dir); - this._allocateChild(label, x, y, arrangement); - } - label.show(); + this._applyLabel(label, action, idx, dir, str); this._curEdited = null; } },